package cn.xinfei.xdecision.common.model.component.guiderule;

import cn.xinfei.xdecision.common.model.BaseDO;
import cn.xinfei.xdecision.common.model.component.IgnoredParamCheck;
import cn.xinfei.xdecision.common.model.component.guiderule.vo.RuleConditionVo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * 规则条件表(t_rule_condition)实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors
@TableName("`t_rule_condition`")
public class RuleConditionInfo extends BaseDO {
	@IgnoredParamCheck
    private static final long serialVersionUID = -55937038829167862L;

    private Long blockId;//规则块的id，关联t_rule_block表id值

	private Integer conditionType;//规则节点的类型：1-关系节点，2-表达式节点

    private String logical;//关系节点的逻辑符号：&&（并关系），||（或关系）

    private String fieldCode;//表达式节点对应的字段id

//    private String fieldEn;//字段的en或者json类型的key
//    private String leftFieldCode;//字段的en或者json类型的key

    private Integer fieldType;//字段的类型：1中间变量 2 入参

    private String operator;//表达式节点的操作符

    private Integer valueType;//变量类型,1:常量，2:变量

    private String value;//表达式节点对应字段的限定值

    private Long ruleId;//规则表的id
//
    private Long versionId;//规则版本的id

    private Long parentId;//父节点的id


	@IgnoredParamCheck
    @TableField(exist = false)
    private String insertTempId;//插入时临时id

	@IgnoredParamCheck
    @TableField(exist = false)
    private String TempParentId;//插入时临时父id

//    @TableField(exist = false)
//    private Integer valueType;//字段值类型

    @IgnoredParamCheck
    @TableField(exist = false)
    private List<RuleLoopGroupAction> loopGroupActions = new ArrayList<>();//循环组对应的条件

    @IgnoredParamCheck
    @TableField(exist = false)
    private RuleConditionVo loopResultCondition;//for对应的结果条件的计算条件树

    @IgnoredParamCheck
    @TableField(exist = false)
    private RuleConditionVo condGroupResultCondition;//条件组对应的结果计算条件树
}
